<%@ page import="com.apexedu.identity.action.IdLoginAction" %>
<%@ page import="com.apexedu.identity.security.CasLoginUtil" %>
<%@ page import="java.math.BigInteger" %>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
    if( IdLoginAction.isSsoEnabled() ){ // 用CAS的登录页面
        response.sendRedirect(CasLoginUtil.getCasServerLoginUrl());
        return;
    }

    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";

    //密钥 密码加密传输时用
    String uuuid = new BigInteger((long)(Math.random() * 999999999999999999l) +"").toString(36);
    session.setAttribute("uuuid", uuuid);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <base href="<%=basePath%>clientui/">
    <title><s:text name="login.name" /></title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <link href="login/skin/style.css" rel="stylesheet" type="text/css" id="skin"/>
    <script type="text/javascript" src="js/jquery-1.4.js"></script>
    <script type="text/javascript" src="js/login.js"></script>
    <script type="text/javascript" src="../resources/js/common/myutil.js"></script>
    <script language="JavaScript" src="../resources/js/userlogin.js"></script>
    <script language="JavaScript" src="../resources/js/md5.js"></script>

    <!--修正IE6支持透明png图片start-->
    <script type="text/javascript" src="js/method/pngFix/supersleight.js"></script>
    <!--修正IE6支持透明png图片end-->

    <script type="text/javascript">
        /**
         * 点击登录按钮事件  密码加密
         */
        function doSubmit(){
            var pwd = hex_md5(document.getElementById('userPawd').value);
            document.getElementById('userPawd').value=hex_hmac_md5('<%=uuuid%>',pwd);
            document.forms[0].submit();
        }
        $(function(){
            $(":password").keydown(function (e) {
                var mykeyCode;
                if ($.browser.msie) {
                    mykeyCode = window.event.keyCode;
                } else {
                    mykeyCode = event.which;
                }
                if (mykeyCode == 13) {
                    doSubmit();
                }
            });
        });
    </script>

    <style>
            /*提示信息*/
        #cursorMessageDiv {
            position: absolute;
            z-index: 99999;
            border: solid 1px #cc9933;
            background: #ffffcc;
            padding: 2px;
            margin: 0px;
            display: none;
            line-height:150%;
        }
            /*提示信息*/
    </style>
</head>
<body >
<div class="login_main">
    <div class="login_top">
        <div class="login_title"></div>
    </div>
    <div class="login_middle">
        <div class="login_middleleft"></div>
        <div class="login_middlecenter">
            <s:form id="userloginForm" onsubmit="return dologin()" action="login" namespace="/identity" method="post" cssClass="login_form">
                <s:hidden name="returnURL" />
                <div class="login_user">
                    <s:textfield tabindex="1" id="userLoginId"
                                 name="tsysUser.userloginid" cssClass="login" size="15"
                                 maxLength="50" cssStyle="ime-mode:disabled"
                            />
                </div>
                <div class="login_pass">
                    <s:password tabindex="2" id="userPawd"
                                name="tsysUser.userpwd" cssClass="login" size="4"
                                maxLength="50" cssStyle="ime-mode:disabled" />
                </div>
                <div class="clear"></div>
                <div class="login_button">
                    <div class="login_button_left"><input id="postButton" type="button" onclick="doSubmit()" value="" onfocus="this.blur()"/></div>
                    <div class="login_button_right"><input type="reset" value="" onfocus="this.blur()"/></div>
                    <div class="clear"></div>
                </div>
            </s:form>
            <div class="login_info" style="color:red" id="SystemResMsg">
                <s:actionerror theme="simple"/>
                <s:actionmessage theme="simple"/>
                <s:fielderror theme="simple"/>
                <%=request.getAttribute("errorMsg")==null?"":request.getAttribute("errorMsg")%>
            </div>
        </div>
        <div class="login_middleright"></div>
        <div class="clear"></div>
    </div>
    <div class="login_bottom">
        <div class="login_copyright"><s:text name="application_name" />  CopyRight 2013 @ <s:text name="application_url" /></div>
    </div>
</div>

</body>
</html>